package principle.lsp.code.after;

/**
 * RectangleDemon
 *
 * @author l56jq
 * @since 2023/11/6 17:03
 */
public class RectangleDemon {
    public static void main(String[] args) {
        // 长方形对象
        Rectangle rectangle = new Rectangle();
        rectangle.setLength(20);
        rectangle.setWidth(10);
        resize(rectangle);
        printLengthAndWidth(rectangle);

        // 正方形对象
        Square square = new Square();
        square.setSize(10);
        printLengthAndWidth(square);
        //
        // square.setLength(20);
        // square.setWidth(10);
        // resize(square);

    }


    // 扩宽方法
    public static void resize(Rectangle rectangle) {
        while (rectangle.getWidth() <= rectangle.getLength()) {
            rectangle.setWidth(rectangle.getWidth() + 1);
        }
    }

    public static void printLengthAndWidth(Quadrilateral quadrilateral) {
        System.out.println("宽度：" + quadrilateral.getWidth());
        System.out.println("长度：" + quadrilateral.getLength());

    }
}
